package com.samuel.learning.design.pattern.singleton;


/**
 * 双重锁
 */
public class DoubleLockSiingleton {
    private static volatile DoubleLockSiingleton ourInstance = null;

    public static DoubleLockSiingleton getInstance() {

        if(null == ourInstance){
            synchronized (DoubleLockSiingleton.class){
                if(null==ourInstance){
                    ourInstance = new DoubleLockSiingleton();
                }
            }
        }

        return ourInstance;
    }

    private DoubleLockSiingleton() {
    }
}
